Add ruff pre-commit hook and apply it
          #3424
        
          
      
                
     Open
            
            
          
  Add this suggestion to a batch that can be applied as a single commit.
  This suggestion is invalid because no changes were made to the code.
  Suggestions cannot be applied while the pull request is closed.
  Suggestions cannot be applied while viewing a subset of changes.
  Only one suggestion per line can be applied in a batch.
  Add this suggestion to a batch that can be applied as a single commit.
  Applying suggestions on deleted lines is not supported.
  You must change the existing code in this line in order to create a valid suggestion.
  Outdated suggestions cannot be applied.
  This suggestion has been applied or marked resolved.
  Suggestions cannot be applied from pending reviews.
  Suggestions cannot be applied on multi-line comments.
  Suggestions cannot be applied while the pull request is queued to merge.
  Suggestion cannot be applied right now. Please check back later.
  
    
  
    
This PR adds the
ruff(checkandformat) pre-commit hook in order to get this codebase closer to PEP 8 compliance. It also adds a GitHub action that runs on PRs / pushes to main that runs the pre-commit hooks.This ensures any PRs that are incoming have code that is formatted properly, so we don't have to have code style discussion as part of PR review.
Note that the only "manual" changes are (1) adding the pre-commit hooks / configuration, and (2) adding the GitHub action to run the hooks; the rest of the changes come from applying the ruff pre-commit hook.
Some more complicated error codes are ignored and can be handled in future PRs.